#include <iostream>
#define LL long long
using namespace std;

const int kMaxN = 110;
const int kMaxK = 1010;
const LL kInf = 1e18;

int f[kMaxN][kMaxK];
int D[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;

  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> D[i];
  }
  int L1, C1, K1;
  int L2, C2, K2;

  cin >> L1 >> C1 >> K1 >> L2 >> C2 >> K2;
  for (int i = 0; i <= n; i++) {
    fill(f[i], f[i] + kMaxK, kMaxK);
  }

  f[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K1; j++) {
      for (int k = 0; k <= j; k++) {
        f[i][j] = min(f[i][j], f[i - 1][j - k] + (max(0, D[i] - L1 * k) + L2 - 1) / L2);
      }
    }
  }

  long long ans = kInf;

  for (int j = 0; j <= K1; j++) {
    if (f[n][j] <= K2) {
      ans = min(ans, (LL)j * C1 + (LL)f[n][j] * C2);
    }
  }
  cout << (ans == kInf ? -1 : ans) << "\n";
  return 0;
}